{include file='header'/}
<link rel="stylesheet" href="__STATIC_ADMIN__/fonts/font_9ooey61lkh/iconfont.css">
<style>
    .layui-layer-title {
        background: #eee !important;
        color: #666 !important;
    }
</style>
<!-- 结 构 代 码 -->
<body class="layui-layout-body pear-admin">
<!-- 布 局 框 架 -->
<div class="layui-layout layui-layout-admin">
    <!-- 顶 部 样 式 -->
    <div class="layui-header">
        <!-- 菜 单 顶 部 -->
        <div class="layui-logo">
            <!-- 图 标 -->
            <img class="logo">
            <!-- 标 题 -->
            <span class="title"></span>
        </div>
        <!-- 顶 部 左 侧 功 能 -->
        <ul class="layui-nav layui-layout-left">
            <li class="collapse layui-nav-item"><a href="#" class="layui-icon layui-icon-shrink-right"></a></li>
            <li class="refresh layui-nav-item"><a href="#" class="layui-icon layui-icon-refresh-1" loading=600></a></li>
        </ul>
        <!-- 多 系 统 菜 单 -->
        <div id="control" class="layui-layout-control"></div>
        <!-- 顶 部 右 侧 菜 单 -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide-xs">
                <a href="#" class="fullScreen layui-icon layui-icon-screen-full" title="{:__('FullScreen')}"></a>
            </li>
            <li class="layui-nav-item layui-hide-xs">
                <a href="/" target="_blank" class="layui-icon layui-icon-website" title="{:__('Home')}"></a>
            </li>
            <li class="layui-nav-item">
                <a href="{:url('admin/index/clearCache')}" title="{:__('ClearCache')}" class="ajaxlink">
                    <i class="layui-icon layui-icon-fonts-clear"></i>
                    <span></span>
                </a>
            </li>
            <li class="layui-nav-item lang">
                <a class="iconfont icon-zhongyingwen2zhongwen" href="javascript:;"></a>
                <dl class="layui-nav-child" style="top:40px;">
                    <dd>
                        <a href="javascript:;" onclick="changeLang('zh-cn')">
                            <span class="iconfont icon-zhongwen1"></span> 简体中文
                        </a>
                    </dd>
                    <dd>
                        <a href="javascript:;" onclick="changeLang('zh-hk')">
                            <span class="iconfont icon-fan"></span> 繁體中文
                        </a>
                    </dd>
                    <dd>
                        <a href="javascript:;" onclick="changeLang('en-us')">
                            <span class="iconfont icon-yingwen1"></span> English
                        </a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item user">
                <!-- 头 像 -->
                <a class="layui-icon layui-icon-username" href="javascript:;"></a>
                <!-- 功 能 菜 单 -->
                <dl class="layui-nav-child">
                    <dd>
                        <a data-open="{:url('admin/admin/adminInfo',['id'=>$admin_id])}"
                           data-title="{:__('BasicInformation')}"
                           data-width="550">
                            {:__('BasicInformation')}
                        </a>
                    </dd>
                    <dd>
                        <a data-open="{:url('admin/admin/adminPass',['id'=>$admin_id])}"
                           data-title="{:__('ChangePassword')}" data-width="550">
                            {:__('ChangePassword')}
                        </a>
                    </dd>
                    <dd>
                        <a href="javascript:void(0);" class="logout">{:__('Logout')}</a>
                    </dd>
                </dl>
            </li>
            <!-- 主 题 配 置 -->
            <li class="layui-nav-item setting"><a href="#" class="layui-icon layui-icon-more-vertical"></a></li>
        </ul>
    </div>
    <!-- 侧 边 区 域 -->
    <div class="layui-side layui-bg-black">
        <!-- 菜 单 顶 部 -->
        <div class="layui-logo">
            <!-- 图 标 -->
            <img class="logo">
            <!-- 标 题 -->
            <span class="title"></span>
            <span class="version">v{:config("version.huicmf_version")}</span>
        </div>
        <!-- 菜 单 内 容 -->
        <div class="layui-side-scroll">
            <div id="sideMenu"></div>
        </div>
    </div>
    <!-- 视 图 页 面 -->
    <div class="layui-body">
        <!-- 内 容 页 面 -->
        <div id="content"></div>
    </div>
    <!--首页右下角登录成功提示框-->
    <div class="login-success-tips-rb" style="padding:15px;display:none">
        <div class="login-success-box">
            <p>当前登录信息：</p>
            <table class="layui-table">
                <tr>
                    <td class="login-success-box-td">IP</td>
                    <td class="session-login-ip"></td>
                </tr>
                <tr>
                    <td class="login-success-box-td">归属地</td>
                    <td class="session-login-address"></td>
                </tr>
            </table>
            <p>上次登录信息：</p>
            <table class="layui-table">
                <tr>
                    <td class="login-success-box-td">IP</td>
                    <td class="session-last-login-ip"></td>
                </tr>
                <tr>
                    <td class="login-success-box-td">归属地</td>
                    <td class="session-last-login-address"></td>
                </tr>
                <tr>
                    <td class="login-success-box-td">时间</td>
                    <td class="session-last-login-time"></td>
                </tr>
            </table>
        </div>

    </div>
    <!-- 页脚 -->
    <div class="layui-footer layui-text">
				<span class="left">
					Released under the MIT license.
				</span>
        <span class="center"></span>
        <span class="right">
					Copyright © 2021-<?php echo date('Y'); ?> huicmf
				</span>
    </div>
    <!-- 遮 盖 层 -->
    <div class="pear-cover"></div>
    <!-- 加 载 动 画 -->
    <div class="loader-main">
        <!-- 动 画 对 象 -->
        <div class="loader"></div>
    </div>
</div>
<!-- 移 动 端 便 捷 操 作 -->
<div class="pear-collapsed-pe collapse">
    <a href="#" class="layui-icon layui-icon-shrink-right"></a>
</div>
{include file='footer'/}
<script>
  layui.use(['admin', 'jquery', 'popup', 'drawer'], function () {
    var $ = layui.jquery;
    var admin = layui.admin;
    var popup = layui.popup;

    admin.setConfigType("yml");
    admin.setConfigPath("/static/admin/lib/pear/pear.config.yml?v=0.1.2");

    admin.render();
    //获取admin-info信息
    $.ajax({
      url: "{:url('index/accountInfo')}",
      dataType: 'json',
      success: function (res) {
        lastLoginBox();
        $('.session-login-ip').text(res.data.login_ip);
        $('.session-login-address').text(res.data.login_address);
        $('.session-last-login-ip').text(res.data.last_login_ip);
        $('.session-last-login-address').text(res.data.last_login_address);
        $('.session-last-login-time').text(res.data.last_login_time);
      }
    });

    function lastLoginBox() {
      /*首页右下角登录成功提示框*/
      if (localStorage.getItem('session-login-success-box') == null) {
        layer.open({
          type: 1,
          title: ['<i class="layui-icon layui-icon-ok-circle" style="font-size:25px; color:#67c23a"></i>&nbsp;登录成功', 'font-size:22px;color:#555;font-weight:bold;'],
          shade: false, // 不显示遮罩
          area: ['365px', '358px'],
          content: $('.login-success-tips-rb'),
          offset: 'rb',
          time: 10000,
          success: function () {
            localStorage.setItem("session-login-success-box", true);
          }
        });
      }
    }

    // 登出逻辑
    admin.logout(function () {
      layer.confirm("{:__('AreYouSure %s',[__('SignOut')])}", {
        btn: ["{:__('Sure')}", "{:__('Cancel')}"]
      }, function () {
        var loading = layer.load(2);
        $.post("{:url('admin/login/logout')}", {}, function (res) {
          layer.close(loading);
          if (res.code === 200) {
            layer.msg(res.msg, {time: 1500}, function () {
              localStorage.removeItem("session-login-success-box");
              parent.window.location = "{:url('admin/login/index')}";
            })
          } else {
            layer.msg("{:__('ConnectError')}", {icon: 2, time: 1800});
          }
        })
      });
      return true;
    })

    window.changeLang = function (lang) {
      // 设置 Cookie
      document.cookie = "{:config('lang.cookie_var')}=" + lang + "; path=/; max-age=31536000"; // 1 year
      $.get("{:url('admin/index/clearCache')}", function () {
        location.reload();
      })
    }

  })
</script>
</body>
</html>
